<?php

namespace bee;
/**
 * 
 * @author dzelenika
 *
 */
class check extends widget
{ 
  public $onChangeFn;
  public $drawMe;
 /**
 * 
 * @var bool
 */
  private $checked;
  public $boundVarValue;
  function __construct($name, &$bindValue = "", $value = "", $id = "")
  { parent::__construct($name); 
    $this->boundVarValue = &$bindValue;
    $this->value = $value;
    //var_dump($bindValue);
    $this->drawMe = true;
  }
/**
 * 
 * @param array $evt
 */
  public function onDraw($evt)
  { if($this->boundVarValue == $this->value)
    { $this->checked = true;
    } else
    { $this->checked = false;
    }
    $this->fillDSDoc();
    
  }
  
  /**
   * 
   * @param sting $fillVar
   */
  public function fillDSDoc($fillVar = "")
  { if($fillVar)
    { $this->DSDoc->setVariable($fillVar, $this->value);
    }
    echo "DM[ $this->name ]: $this->drawMe<br>";
    if($this->drawMe)
    {  $this->DSDoc->setObject("widgets/" . $this->name, $this, false);
    }
  }
  public  function __set($name, $value)
  { $this->$name = $value;
    echo "** $value **<br />";
  }
  public function __get($name)
  {  return $this->$name;
    
  }
}
